#ifndef EDITORCORE_ENTITYUNDERCURSORFINDER_H
#define EDITORCORE_ENTITYUNDERCURSORFINDER_H

#include "Common/Algebra/Vec2.h"
#include "EditorCore/IEntity.h"
#include "EditorCore/Visitors/IEntityVisitor.h"

namespace editor_core {

	class EntityUnderPositionFinder : public IEntityVisitor
	{
	public:
		EntityUnderPositionFinder( const cmn::Vec2& position );
		virtual ~EntityUnderPositionFinder();

		virtual void VisitEntity( IEntity* entity );

		inline IEntity* GetFoundEntity() const { return m_foundEntity; }

		static IEntity* FindEntityUnderCursor( IEntity* root, const cmn::Vec2& position );

	private:
		cmn::Vec2 m_position;
		bool m_entityIsFound;
		IEntity* m_foundEntity;

	};
}

#endif
